
	// Yeu cau nap tien tu client
	public void Nap(String stk, int sotien) throws Exception {
		Calendar cal = Calendar.getInstance();
		SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
		String day = sdf.format(cal.getTime());
		int sodong = 0;
		int tongtien = 0;
		String url = "com.mysql.jdbc.Driver";
		synchronized (Getaccount(stk)) {

			try {
				Class.forName(url);
				Connection cn = DriverManager.getConnection(
						"jdbc:mysql://localhost:3306/atm", "root", "");
				String sql = "select* from khachhang where sotaikhoan='" + stk
						+ "'";
				PreparedStatement stmt = cn.prepareStatement(sql);
				ResultSet r = stmt.executeQuery();// thuc thi lay ra tong tien
				while (r.next()) {
					tongtien = r.getInt("tongtien");
				}
				tongtien = tongtien + sotien;
				String sql1 = "update khachhang set tongtien=" + tongtien
						+ " where sotaikhoan='" + stk + "'";
				PreparedStatement stmt1 = cn.prepareStatement(sql1);
				sodong = stmt1.executeUpdate();
				String sql2 = "insert into lichsugiaodich(sotaikhoan,ngaythang,sotien,lydo) Values('"
						+ stk + "'," + day + "," + sotien + ",'NapTien')";
				PreparedStatement stmt2 = cn.prepareStatement(sql2);
				stmt2.executeUpdate();
				System.out.println("Da ghi lai lich su giao dich");
				cn.close();
			} catch (Exception e) {
				System.out.println(e);
			}
			out.println(sodong);
			out.flush();
			out.println(tongtien);
			out.flush();
		}
	}
